# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=diceware
pkgver=0.10
pkgrel=0
pkgdesc="Passphrases you will remember"
url="https://github.com/ulif/diceware"
arch="noarch"
license="GPL-3.0-or-later"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://github.com/ulif/diceware/archive/v$pkgver/diceware-$pkgver.tar.gz
	no-pkg_resources.patch
	"

prepare() {
	default_prepare

	sed -i "s/version = .*/version = '$pkgver'/" diceware/__about__.py
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
8fa8979c39ccb4b4a2de2f326794d3ea685edfb280fc24b0709a891636201d7c2206e5a804705132facf2f9c81866f32c3f950817fa5fc88cc2bf0300c62d9ba  diceware-0.10.tar.gz
9598d2576bf75933a92b003b52e38964e4949197bbdbed5edf95b605e7634fbae814d88f26fee43772f0341ef1bd2d2325d3a7638ba0d3598d308607476f7805  no-pkg_resources.patch
"
